# coding=utf-8
"""
作者：董新强 
创建时间：
描述：
"""
import time
from concurrent.futures.thread import ThreadPoolExecutor

import requests

from setting import AUTH_VALIDATE_URI


def tt():
    try:
        post_body = {
            "id": "ee94a3106a5411eaa18114dda9040cae",
            "token": "Token erkLJASvyoeGFn5oIFJVUJtcxcK4zdU2MpwACvJ2hwyk5r3CtEvJzqfR1Yc37KKERWPKfyYxGX/N/AdfReTJrlzhPWCOUHw6zg9TdugEk8ENg0s+z68fUxWunRh3W0Ww"
        }

        result = requests.post(AUTH_VALIDATE_URI, json=post_body).json()
        print(result)
    except:
        print('失败')


if __name__ == '__main__':
    def run(threadnum):
        st = time.time()
        with ThreadPoolExecutor(threadnum) as ex:
            for _ in range(2000):
                ex.submit(tt)

        et = time.time() - st
        print(threadnum, '->', et, 2000.0 / et, et / 2000.0)


    # for i in range(10):
    #     run((i + 1) * 50)
    tt()
